package com.leyou.auth.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author YYP
 * @date 2020/12/28
 * 将OSS注入到Spring容器：
 * 属性类读取属性文件，配置类使用属性类
 */
@Configuration
public class OSSConfig {

    @Bean
    public OSS ossClient(OSSProperties properties){
        return new OSSClientBuilder()
                .build(properties.getEndpoint(),properties.getAccessKeyId(),properties.getAccessKeySecret());

    }
}
